var TTDConversionEvents;(()=>{"use strict";var e={d:(n,t)=>{for(var r in t)e.o(t,r)&&!e.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:t[r]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{argsToSdkFunction:()=>Se,clearAllConfigs:()=>je,event:()=>Le});var t={tcfV2ConsentVersion:2,consentRequestHasTimedOut:!1,waitForConsentTimeout:null,consentCheckExists:!1,isGdprApplicable:!1,gdprConsentString:null};function r(){return new URL(window.location.href).searchParams.has("upjs_debug")}function i(){return r()||null!=localStorage.getItem("enable-ttd-pixel-debugging")}function o(e){if(!e)return"";var n=void 0!==e.advertiserId&&null!==e.advertiserId?"adv_".concat(e.advertiserId):"merchant_".concat(e.merchantId),t=e.pixelIds&&e.pixelIds.length>0?"|".concat(e.pixelIds.join(",")):"";return"".concat(n).concat(t," ")}function a(e,n){var t=i(),r=(null==n?void 0:n.enableDebug)||!1;if(t||r){var a=o(n);console.info("TTD Pixel v3: ".concat(a).concat(e))}}function c(e,n){var t=i(),r=(null==n?void 0:n.enableDebug)||!1;if(t||r){var a=o(n);console.error("TTD Pixel v3: ".concat(a).concat(e))}}function d(e,n){for(var t=[],r=2;r0?n:void 0}return Array.isArray(e)?e:void 0}}function f(e,n,t){var r=null!=e?"adv_".concat(e):"merchant_".concat(n);return t?"".concat(r,"|").concat(t):r}function p(e,n,t,r,i){r=v(r);for(var o=u(n),l=u(t),s=r&&r.length>0,p=o||l,g=Array.from(new Set(e.values())),h=0,m=s?r.map((function(e){return f(n,t,e)})):[f(n,t)];h0)return a("Partial config match found",w[0]),w.length>1&&d("Multiple partial config matches found, using first one",w[0],w.slice(1)),w[0];if(p)return void c("No matching config found for adv/merchant '"+n+"/"+t+"', event will not fire")}if(!p||!s)return 1===g.length?(a("Single config found, using it for event",g[0]),g[0]):(d("Event ids not sent, will use mostRecentInitConfig",i),i);c("Event sent ids (advId: "+n+", merchantId: "+t+", pixelIds: "+(null==r?void 0:r.join(","))+") but no exact config match found, event will not fire")}var g=function(){return g=Object.assign||function(e){for(var n,t=1,r=arguments.length;t0){var d=c[c.length-1];d&&R(d,r,e)&&(r=d,M(e,"strategy 4: found toporigin: "+d+" from origins: "+c))}}catch(n){M(e,"strategy 4: ancestorOrigins unsupported, continue")}if(!r||P(r)){var l=function(e){try{if((t=document.querySelector("link[rel='canonical']"))&&(r=t.href))return r}catch(n){M(e,"strategy 5: canonical link not accessible in current document")}for(var n=window;;)try{if(n.parent===n)break;var t,r;if((t=(n=n.parent).document.querySelector("link[rel='canonical']"))&&(r=t.href))return r}catch(n){M(e,"strategy 5: cross-origin parent, cannot read canonical link");break}return""}(e);l&&R(l,r,e)&&(r=l,M(e,"strategy 5: canonical url found"))}if(!r||P(r)){var s=function(e,n){try{var t=window.dataLayer;if(!t||!Array.isArray(t))return M(n,"strategy 6: dataLayer not present or not an array"),"";var r="";try{r=e?new URL(e).origin:""}catch(t){M(n,"strategy 6: could not parse known origin: "+e)}for(var i=t.length-1;i>=0;i--){var o=t[i];if(o&&"object"==typeof o&&!Array.isArray(o))for(var a=0,c=A;a1)return r+l;M(n,"strategy 6: dataLayer["+i+"]."+d+" is not a valid URL: "+l)}}}}catch(e){M(n,"strategy 6: error reading dataLayer, continue")}return""}(r,e);s&&R(s,r,e)&&(r=s,M(e,"strategy 6: dataLayer url found: "+s))}var u=function(e,n,t){var r=[];n&&n.includes("?")&&r.push(n),e&&e.includes("?")&&function(e){try{return"/"===new URL(e).pathname||-1!==e.indexOf("cloudfront.net")}catch(e){return!1}}(e)&&r.push(e);for(var i=0,o=r;i0)return;null==e||e.resolveWith(document,[r])}},bindReady:function(){if(!e){if(e=r._Deferred(),"complete"===document.readyState)return setTimeout((function(){return r.ready()}),1);if(document.addEventListener)document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",(function(){return r.ready()}),!1);else if(document.attachEvent){document.attachEvent("onreadystatechange",n),window.attachEvent("onload",r.ready);var t=!1;try{t=null==window.frameElement}catch(e){console.log(e)}document.documentElement.doScroll&&t&&i()}}},_Deferred:function(){var e,n=[],t=!1,i=!1,o={done:function(){for(var t=[],a=0;a0){var a=e.querySelectorAll(p);a&&a.forEach((function(e){r.includes(e)||r.push(e)}))}for(var c=window.location.hostname,d=document.getElementsByTagName("iframe"),l=0,s=Array.from(d);l0&&u.contentDocument.querySelectorAll(p).forEach((function(e){r.includes(e)||r.push(e)}))}}return r}function X(e,n){var t=0,r=null;return new MutationObserver((function(i,o){var a=Date.now(),c=a-t;c>=n?(t=a,e(i,o)):(r&&clearTimeout(r),r=setTimeout((function(){t=Date.now(),e(i,o)}),n-c))}))}function $(e,n){if(!n.src)return!1;try{var t=e===new URL(n.src).hostname;return t&&Z("Iframe "+n.src+" can be accessed"),t}catch(e){return Z("error: ",e),!1}}function Q(e){var n=e.currentTarget;if(n&&n.__upixel_detection)try{H(n.__upixel_detection.root,n.__upixel_detection.scopeName,n.__upixel_detection.config)}catch(e){Z(e)}}function Y(e,n){return function(e,n){var t=/((([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,}))/i;if(n.detectionSubject.includes("email")&&t.test(e)){var r=function(e){return e.toLowerCase().trim()}(e.match(t)[0]);return Z("We detected email: "+r),function(e,n){if(e&&n){var t=new CustomEvent("detected-identifier",{detail:{identifier:e,type:n}});Z("Dispatched event with identifier: ",e," and type: ",n),window.dispatchEvent(t)}}(r,"email"),!0}return!1}(e,n)}function Z(e){for(var n=[],t=1;t0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?r.map((function(e){return f(n,t,e)})):[f(n,t)],a=0,c=o;a0)||t.includes(oe.pixelId)}(e.adv,e.pixel_ids)&&(se(n.uidConfig)?e.uid2_token=n.uidConfig.uid_token:le(n.uidConfig)&&(e.euid_token=n.uidConfig.uid_token));var k={data:[Ie(Ie({},e),{privacy_settings:y})]};(n.enableDebug||e.debug)&&(k.debug="1"),function(e,n,t){var r=this,i="".concat(e.rootUrl,"/track/realtimeconversion");return a("trigger POST realtime conversion event",e),new Promise((function(o,c){var d=new XMLHttpRequest;d.withCredentials=!0,d.open("POST",i),d.setRequestHeader("Content-type","application/json"),d.setRequestHeader("eventDataSource",e.eventDataSource||"JsSdk"),d.setRequestHeader("eventDataSourceVersion",e.pixelVersion),d.onload=function(){d.status>=200&&d.status<300?o(d.response):c(d.response)},d.onerror=function(){return xe(r,void 0,void 0,(function(){var r;return ke(this,(function(i){return r=function(e){var n,t=null!==(n=e.responseText)&&void 0!==n?n:JSON.parse(e.responseText);return(null==t?void 0:t.Message)?t.Message:0!==e.status||e.responseText?"Status Code ".concat(e.status):"Request never hit server. Possible CSP violation."}(d),c(d.statusText),function(e,n,t,r){var i,o,c,d;xe(this,void 0,void 0,(function(){var l,s,u,v;return ke(this,(function(f){var p,g,h;return l="universal_pixel_realtime_fallback_"+(null!==(d=null!==(o=null===(i=t.pixel_ids)||void 0===i?void 0:i.join("_"))&&void 0!==o?o:null===(c=e.pixelIds)||void 0===c?void 0:c.join("_"))&&void 0!==d?d:""),a("trigger GET realtime conversion event fallback",e),p=n.data[0],g=Object.entries(p).filter((function(e){var n=e[0],t=e[1];return("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"pixel_ids"===n)&&null!=t&&""!==t})),h=new URLSearchParams,g.forEach((function(e){var n=e[0],t=e[1];h.append(n,String(t))})),s=h,u=(e.eventDataSource||"JsSdk")+"Get",v=e.pixelVersion,s.set("eds",u),s.set("edsv",v),s.set("rt_fallback","1"),""!==r&&s.set("rt_fbErr",r),C("".concat(e.rootUrl,"/track/rt?").concat(s.toString()),l,"TTD Universal Pixel Realtime Fallback"),[2]}))}))}(e,n,t,r),[2]}))}))},d.send(JSON.stringify(n))}))}(n,k,e).catch((function(e){return c(e,n)}))}window.ttdConversionEventsLayer=window.ttdConversionEventsLayer||[],window.ttdConversionEvents=null!==(_e=window.ttdConversionEvents)&&void 0!==_e?_e:{activeDetection:null,startDetection:null},function(e,n,t){if(t||2===arguments.length)for(var r,i=0,o=n.length;i